{% extends "base.html" %}
{% block page_title %}myASN{% endblock %}
{% block content %}
	<ul id="nav">
	  <li><a href="/defence/" title="My Alarms">My Alarms</a><span>/</span></li>
	  <li><a href="/defence/myPrefix" title="My Prefixs">My Prefixs</a><span>/</span></li>
	  <li><a href="/defence/myASN" title="My ASNs">My ASNs</a><span>/</span></li>
	  <li><a href="/account/profile/" title="My Account">My Account</a><span>/</span></li>
	</ul><!--end nav--><!-- class="current" class="anews"-->
	{% if msg %}
	<div class="notice">
		<p class="warn">{{msg}}</p>
	</div>
	{% endif %}
	<div id="featured-projects">
    <h4 align="center">My ASNs</h4>
	<div>
      <form action="/defence/myASN/" method="post">{% csrf_token %}
            <input type="submit" value="add ASN">
            AS: <input type="text" name="asn" />
			{% if error %}
            <font color="red">{{error}}</font>
            {% endif %}
      </form>
    </div>
    <br/>
    <table>
      <tr><td>
        <table>
          <head><tr><th>#</th></tr></head>
          <body>{% for asn in ASNs %}<tr><td align=right>{{ forloop.counter }}</td></tr>{% endfor %}</body>
        </table>
      </td>
      <td>
        <table id="alarms" class="tablesorter">
          <thead>
            <tr>
              <th>Time (UTC)</th>
              <!--<th>Timestamp</th>-->
              <th>ASN Number</th>
              <!--<th>RPKI</th>-->
              <th>Operation</th>
            </tr>
          </thead>
          <tbody>
          {% for asn in ASNs %}
            <tr>
              <td>{{ asn.time|date:"Y-m-d H:i:s" }}</td>
              <!--<td>{{ alarm.0.time }}</td>-->
              <td>
                <a href="http://bgp.he.net/AS{{ asn.number }}" target="_blank">{{ asn.number }}</a>
              </td>
              <!--<td align=right>{{ alarm.0.rpki }}</td>-->
			  <form action="/defence/myASN/"  method="post">{% csrf_token %}
			  <input type="hidden" name="deleteASN" value="{{asn.number}}" />
              <td><input type="submit" value="delete"></td>
			  </form>
            </tr>
          {% endfor %}
          </tbody>
        </table>
      </td></tr>
    </table>
  </div><!--end featured-projects-->
{% endblock %}
{% block js_script %}
  <script src="/static/jquery-latest.js"></script>
  <script type="text/javascript" src="/static/jquery.tablesorter.js"></script>
  <script type="text/javascript">
    $(document).ready(function(){ 
        $("#alarms").tablesorter();
      }
    );
  </script>
{% endblock %}
